package com.greenyoung.pwiki.common.consts;

/**
 * 存放Elasticsearch pipeline有关的常量
 */
public class ConstElPipeline {
    public static final String PIPELINE_ID = "attachment3";
    public static final String PIPELINE_ID2 = "attachment2";

    /**
     * 如果不指定pipeline的最大产长度，那么indexed_chars默认是100000,
     * 如果指定-1，那么则不限长度，但是会受到内存限制而导致文件上传不完全
     * <p>
     * TODO：设置一个最大长度，并且在用户上传文件时加以限定
     */
    public static final String PIPELINE_CONFIG = "{\n" +
            "  \"description\": \"Extract attachment information encoded in Base64 with UTF-8 charset\",\n" +
            "  \"processors\": [\n" +
            "    {\n" +
            "      \"attachment\": {\n" +
            "        \"field\": \"data\",\n" +
            "        \"indexed_chars\": -1,\n" +
            "        \"properties\": [\n" +
            "          \"content\",\n" +
            "          \"title\",\n" +
            "          \"author\",\n" +
            "          \"keywords\",\n" +
            "          \"date\",\n" +
            "          \"content_length\",\n" +
            "          \"content_type\"\n" +
            "        ]\n" +
            "      }\n" +
            "    },\n" +
            "    {\n" +
            "      \"remove\": {\n" +
            "        \"field\": \"data\"\n" +
            "      }\n" +
            "    }\n" +
            "  ]\n" +
            "}";

    public static final String PIPELINE_CONFIG_WITH_CONTENT_LENGTH_LIMIT_200000 = "{\n" +
            "  \"description\": \"Extract attachment information encoded in Base64 with UTF-8 charset\",\n" +
            "  \"processors\": [\n" +
            "    {\n" +
            "      \"attachment\": {\n" +
            "        \"field\": \"data\",\n" +
            "        \"indexed_chars\": 200000,\n" +
            "        \"properties\": [\n" +
            "          \"content\",\n" +
            "          \"title\",\n" +
            "          \"author\",\n" +
            "          \"keywords\",\n" +
            "          \"date\",\n" +
            "          \"content_length\",\n" +
            "          \"content_type\"\n" +
            "        ]\n" +
            "      }\n" +
            "    },\n" +
            "    {\n" +
            "      \"remove\": {\n" +
            "        \"field\": \"data\"\n" +
            "      }\n" +
            "    }\n" +
            "  ]\n" +
            "}";
}
